package com.tom.springframework.beans.factory.support;

import com.tom.springframework.beans.factory.config.SingletonBeanRegistry;

import java.util.HashMap;
import java.util.Map;

/**
 * 默认单例Bean注册
 *
 * @author zx
 * @date 2024-11-05 09:58
 */
public class DefaultSingletonBeanRegistry  implements SingletonBeanRegistry {
    private Map<String,Object> singletonObjects = new HashMap<>();
    @Override
    public Object getSingleton(String beanName) {
        return singletonObjects.get(beanName);
    }

    @Override
    public void registerSingleton(String beanName, Object singletonObject) {
         singletonObjects.put(beanName,singletonObject);
    }
}
